home *** CD-ROM | disk | FTP | other *** search
- --------------------------------------------------------------------------------
- -- Weapon Balloon
- -- Original Carnage Contest Weapon
- -- Script by DC, August 2009, www.UnrealSoftware.de
- --------------------------------------------------------------------------------
-
- -- Setup Tables
- if cc==nil then cc={} end
- cc.balloon={}
-
- -- Load & Prepare Ressources
- cc.balloon.gfx_wpn=loadgfx("weapons/balloon.png") -- Weapon Image
- setmidhandle(cc.balloon.gfx_wpn)
- cc.balloon.sfx_wpn=loadsfx("pop.wav") -- Balloon Pop Sound
-
- --------------------------------------------------------------------------------
- -- Weapon: balloon
- --------------------------------------------------------------------------------
-
- cc.balloon.id=addweapon("cc.balloon","Balloon",cc.balloon.gfx_wpn,1) -- Add Weapon (1 use)
-
- function cc.balloon.draw() -- Draw
- if weapon_mode==1 then
- setblend(blend_alpha)
- setalpha(0.6)
- setcolor(255,255,255)
- setscale(getplayerdirection(0),1)
- setrotation(0)
- drawimage(cc.balloon.gfx_wpn,getplayerx(0),getplayery(0)-33)
- hudinfo("Hit [Space] again to deactivate the balloon!")
- elseif weapon_shots==0 then
- hudinfo("Hit [Space] once to activate the balloon!")
- end
- end
-
- function cc.balloon.attack(attack) -- Attack
- if weapon_timer>0 then
- weapon_timer=weapon_timer-1
- end
- if (weapon_mode==0) and (weapon_shots==0) and (attack==1) then
- -- Use weapon and allow to use another one afterwards (1)
- useweapon(1)
- -- Activate
- weapon_mode=1
- weapon_shots=1
- weapon_timer=50
- -- Initial Push
- playerpush(0,0,-3.0,1)
- elseif (weapon_mode==1) then
- -- Disable balloon
- if (attack==1 and weapon_timer<=0) then
- -- Kill by attack
- weapon_mode=0
- elseif collision(cc.balloon.gfx_wpn,getplayerx(0),getplayery(0)-33,1,0)==1 then
- -- Kill by collision
- weapon_mode=0
- elseif getframesleft()<=1 then
- -- Kill by timeout
- weapon_mode=0
- end
- -- Kill? -> FX!
- if weapon_mode==0 then
- particle(p_ring,getplayerx(0),getplayery(0)-33)
- playsound(cc.balloon.sfx_wpn)
- end
- -- Control speed
- playerpush(0,getwind()*10.0,-1.0,1)
- end
- end